<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>天下行租车</title>
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
    <link  href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
    <link rel="stylesheet" href="css/base.css">
</head>
<body>
<div id="app">
    <header>
        <div class="c900 flex">
            <a href="index.html"><h1>天下行汽车租赁平台</h1></a>
        </div>
    </header>
    <main class="c900 el-card" style="align-items: stretch; width: 300px; padding: 0px 20px;">
        <h2>用户登录</h2>
        <el-form label-width="50px" label-position="left">
            <el-form-item label="账号: ">
                <el-input placeholder="账号" v-model="form.username"></el-input>
            </el-form-item>
            <el-form-item label="密码: ">
                <el-input type="password" placeholder="密码" v-model="form.password"></el-input>
            </el-form-item>
            <el-form-item style="text-align: right">
                <el-link :underline="false" @click="alert('有缘人, 这个功能交给实现你了!')">忘记密码</el-link>
                <el-button type="primary" @click="login">登录</el-button>
            </el-form-item>
        </el-form>
    </main>
</div>
<script>
    var v = new Vue({
        el : "#app",
        data:{
            myinfo: null,
            form:{},
            usernameColumn: null,
        },
        methods:{
            login(){
                axios.get("/login/login",{
                    params: this.form
                }).then(res=>{
                    if(res.data.code == 1){
                        this.$message(res.data.message);
                        this.myinfo = res.data.data.user;
                        if (res.data.data.goto){
                            location.href=res.data.data.goto;
                            return;
                        }
                        location.href="index.html";
                    } else {
                        this.$alert(res.data.message);
                    }
                });
            }}
    })
</script>
</body>
</html>
